package com.bwie.es;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * @Author:杨珂
 * @CreateTime: 2025-03-29
 */

/**
 * 商品Es的对象
 */
@Data
@Document(indexName = "es_prod", shards = 1, replicas = 0)
public class EsProd implements Serializable {
    /**
     * 商品ID
     */

    @Id
    @Field(type = FieldType.Keyword)
    private Integer prodId;

    /**
     * 商品名称
     */
    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String prodName;

    /**
     * 商品类型
     */
    @Field(type = FieldType.Integer)
    private Integer prodType;

    /**
     * 商品价格
     */
    @Field(type = FieldType.Double)
    private Double prodPrice;

    /**
     * 库存
     */
    @Field(type = FieldType.Integer)
    private Integer prodStock;

    /**
     * 商品状态：0草稿1待审核2上线3驳回4下线
     */
    @Field(type = FieldType.Integer)
    private Integer prodStatus;

    /**
     * 录入时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8", shape = JsonFormat.Shape.STRING)
    @Field(type = FieldType.Date, format = DateFormat.custom, pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /**
     * 驳回原因
     */
    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String reason;

    private static final long serialVersionUID = 1L;
}
